添加动态属性   move  bool  true 
 添加过滤事件
ui->PicToolWid->installEventFilter(this);
if(obj->property("move").toBool())
{
        QWidget *w = static_cast<QWidget *>(obj);
        QMouseEvent *mouseEve = static_cast<QMouseEvent *>(event);
    if (event->type() == QEvent::MouseButtonPress)
    {
        obj->setProperty("pressState",1);
        obj->setProperty("pos1",QVariant( mouseEve->globalPos()));
        obj->setProperty("pos2",QVariant( w->frameGeometry().topLeft()));
        return true;
    }
    else if (event->type() == QEvent::MouseButtonRelease)
    {
        obj->setProperty("pressState",0);
        return true;
    }
    else if (event->type() == QEvent::MouseMove)
    {
        if(obj->property("pressState").toBool())
        {
            QPoint relativePos = mouseEve->globalPos()  - obj->property("pos1").toPoint();
            w->move(obj->property("pos2").toPoint() + relativePos);
            return true;
        }
    }
}
//如果存在按钮，想让按钮拖着走的话
 if(obj->property("haveParent").toBool())
    {
        QWidget *w = static_cast<QWidget *>(obj->parent());
        if(w->property("move").toBool())
        {
            QMouseEvent *mouseEve = static_cast<QMouseEvent *>(event);
           if (event->type() == QEvent::MouseButtonPress)
           {
               w->setProperty("pressState",1);
               w->setProperty("pos1",QVariant( mouseEve->globalPos()));
               w->setProperty("pos2",QVariant( w->frameGeometry().topLeft()));
               obj->setProperty("moved",false);
               return QWidget::eventFilter(obj, event);
           }
           else if (event->type() == QEvent::MouseButtonRelease)
           {
               if(w->property("pressState").toUInt())
               {
                   w->setProperty("pressState",0);
                   if(obj->property("moved").toBool())
                   {
                       return true;
                   }
                   else
                   {
                       return QWidget::eventFilter(obj, event);
                   }

               }
           }
           else if (event->type() == QEvent::MouseMove)
           {
               if(w->property("pressState").toUInt())
               {
                 obj->setProperty("moved",true);
                  QPoint relativePos = mouseEve->globalPos()  - w->property("pos1").toPoint();
                  w->move(w->property("pos2").toPoint() + relativePos);
                  return QWidget::eventFilter(obj, event);
               }
           }
        }
    }